Re: howto: read file last modified date/time.

"Phil Sayers" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nant.user
Message-ID <010a01ca24d0$51818280$f4848780$@net>
Apologies, I should have been more specific...

I needed to get the last modified date/time in a specific format, as part of
building an xml file.
I ended up with a dirty script task that looks like this.

<script language="vb" prefix="FuncLib">
		<code>
		<![CDATA[

		<[Function]("GetFileLastModifiedDate")> _
		public shared function GetFileLastModifiedDate(filepath as
String) as String
			return new
System.IO.FileInfo(filepath).LastWriteTimeUtc.ToString("s")
		End Function

		]]>
		</code>
	</script>

Anyway...thanks for the help, problem solved.

-----Original Message-----
From: Bob Archer [mailto:[email protected]] 
Sent: Monday, August 17, 2009 11:54 AM
To: Phil Sayers; [email protected]
Subject: Re: [NAnt-users] howto: read file last modified date/time.

YEs, use the file:: functions. There is one to get the create date and one
to get the modify date.

file::get-last-write-time() is what you are looking for as far as I can
tell.

BOb


> -----Original Message-----
> From: Phil Sayers [mailto:[email protected]]
> Sent: Tuesday, August 11, 2009 11:22 AM
> To: [email protected]
> Subject: [NAnt-users] howto: read file last modified date/time.
> 
> Hi
> 
> I don't see an out-of-the-box nant file function to read the last
> modified
> date/time of a file into a property.  The opposite of the 'touch' task.
> I checked nantcontrib and I didn't see anything there (unless I missed
> it)
> 
> Is anyone away of an existing library or code snippet I can copy/paste
> that
> may accommodate this before I go an re-invent the wheel?
> 
> Thanks
> Phil
> 
> 
> -----------------------------------------------------------------------
> -------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> NAnt-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/nant-users

----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus
on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.